-
-
Notifications
You must be signed in to change notification settings - Fork 147
West Midlands | ITP-MAY25 | Saleh Yousef | Module-Data-Groups | Sprint-2 #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct
@@ -11,5 +11,7 @@ const recipe = { | |||
}; | |||
|
|||
console.log(`${recipe.title} serves ${recipe.serves} | |||
ingredients: | |||
${recipe}`); | |||
ingredients:`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor query here shouldn't the console read out "bruschetta serves 2, the ingredients are: ". Your code reads "bruschetta serves 2 ingredients: ". Otherwise this works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both tests pass - well done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code works however do some further research on how this could be improved. For example dealing with URL encoded string(decodeURIComponent). Then you could write a test to see if your solution works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code works for tests. Do some further research on how code could be improved to handle edge cases such as undefined values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is generally looking really good, just one thing to pick up :)
const [key, ...rest] = pair.split("="); | ||
queryParams[key] = rest.join("="); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you fixed a bug here but didn't write a test for it - can you add a test for the edge case you fixed?
|
||
test("parses querystring with multiple values", () => { | ||
expect(parseQueryString("name=John&age=30")).toEqual({ | ||
"name": "John", | ||
"age": "30", | ||
}); | ||
}); | ||
test("parses querystring with multiple values with same key", () => { | ||
expect(parseQueryString("name=John&name=Jane")).toEqual({ | ||
"name": "Jane", // Last value should overwrite previous ones | ||
}); | ||
}); | ||
|
||
test("parses querystring without key", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good edge cases!
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
This PR implements and tests functions: createLookup, parseQueryString, tally, and invert.
Includes bug fixes, edge case handling, and validation with unit tests.
Questions
Ask any questions you have for your reviewer.